/*
 *  Copyright 2008-2010 www.jrails.org
 *  Licensed under the Apache License, Version 2.0 (the "License");
 *  you may not use this file except in compliance with the License.
 *  You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the License is distributed on an "AS IS" BASIS,
 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *  See the License for the specific language governing permissions and
 *  limitations under the License.
 */

package org.rails.extjs;

import org.rails.extjs.BoxComponent;
import org.rails.extjs.Option;

public class Slider extends BoxComponent {

	public Slider() {
		super();
	}
	
	public Slider(Number minValue,Number maxValue,Number value) {
		super();
		setMinValue(minValue);
		setMaxValue(maxValue);
		setValue(value);
	}

	public Slider(Option configOptions) {
		super(configOptions);
	}

	public Slider(String id) {
		super(id);
	}
	
	public void setAnimate(Boolean animate){
		addOption("animate", animate);
	}
	
	public Boolean isAnimate(){
		return getBoolean("animate",true);
	}
	
	public void setClickToChange(Boolean clickToChange){
		addOption("clickToChange", clickToChange);
	}
	
	public Boolean isClickToChange(){
		return getBoolean("clickToChange",true);
	}
	
	public void setDecimalPrecision(Integer decimalPrecision){
		addOption("decimalPrecision",decimalPrecision);
	}

	public Integer getDecimalPrecision(){
		return getInteger("decimalPrecision",0);
	}
	
	public void setIncrement(Number increment){
		addOption("increment", increment);
	}
	
	public Number getIncrement(){
		return getNumber("increment",0);
	}
	
	public void setKeyIncrement(Number keyIncrement){
		addOption("keyIncrement", keyIncrement);
	}
	
	public Number getKeyIncrement(){
		return getNumber("keyIncrement",0);
	}
	
	public void setMaxValue(Number maxValue){
		addOption("maxValue", maxValue);
	}
	
	public Number getMaxValue(){
		return getNumber("maxValue",100);
	}
	
	public void setMinValue(Number minValue){
		addOption("minValue", minValue);
	}
	
	public Number getMinValue(){
		return getNumber("minValue",0);
	}
	
	public void setValue(Number value){
		addOption("value", value);
	}
	
	public Number getValue(){
		return getNumber("value",0);
	}
	
	public void setVertical(Boolean vertical){
		addOption("vertical", vertical);
	}
	
	public Boolean isVertical(){
		return getBoolean("vertical",false);
	}
	
	@Override
	public String getScript() {
		script = new StringBuffer("");
		createItems();
		script.append("new Ext.Slider(");
		script.append(createOptions());
		script.append(")");
		return script.toString();
	}

}
